package com.ems.sys.dao;

import com.ems.sys.pojo.Users;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/****
 * @Author:传智播客
 * @Description:Emlpoyee的Dao
 * @Date 2019/6/14 0:12
 *****/
public interface UserMapper extends Mapper<Users> {
    @Select("select * from users")
    @Results({
            @Result(id=true ,column = "uId",property = "uId"),
            @Result(column = "username",property = "username"),
            @Result(column = "password",property = "password"),
            @Result(column = "createDate",property = "createDate"),
            @Result(column = "status",property = "status"),
            @Result(column = "imgUrl",property = "imgUrl"),
            @Result(
                    property = "roleList",
                    column = "uId",
                    javaType = List.class,
                    many = @Many(select = "com.ems.sys.dao.RoleMapper.findRoleByUserId")
            )
    })
    List<Users> findByUsername();


}
